//
//  NSObject+HDHeaderModel.m
//  app
//
//  Created by D on 15/5/13.
//  Copyright (c) 2015年 hdaren. All rights reserved.
//

#import "HDHeaderModel.h"

@implementation HDHeaderModel

-(instancetype)initWithDict:(NSDictionary *)dict
{
    if (self = [super init]) {
        self.user_name = dict[@"nickname"];
        self.user_level = dict[@"level"];
        self.user_score = dict[@"scores"];
        self.user_face_urlStr = dict[@"face"];
        self.user_gender = dict[@"gender"];
        self.user_gold = dict[@"gold"];
        [[NSUserDefaults standardUserDefaults] setObject:self.user_gold forKey:@"gold"];
        [[NSUserDefaults standardUserDefaults] setObject:self.user_name forKey:@"nickname"];
        [[NSUserDefaults standardUserDefaults] synchronize];
        self.name_wight = [XCommon widthForString:self.user_name fontSize:17];
    }
    
    return self;
}

+(instancetype)modelWithDict:(NSDictionary *)dict
{
    return [[self alloc] initWithDict:dict];
}

@end
